<div class="task">
<?php include ('buttons.tpl'); ?>
</div>
<?php if ($error) { ?>
<div class="warning"><?php echo $error; ?></div>
<?php } ?>
<h2><?php echo $heading_title; ?></h2>
<div class="description"><?php echo $heading_description; ?></div>
<form action="<?php echo $action; ?>" method="post" enctype="multipart/form-data" id="form">
  <div id="tabs">
	<ul>
	  <li><a href="#tabs-1"><?php echo $tab_general; ?></a></li>
	</ul>
	<div id="tabs-1">
      <table>
        <tr>
          <td width="185"><span class="required">*</span> <?php echo $entry_name; ?></td>
          <td><input name="name" value="<?php echo $name; ?>" />
            <?php if ($error_name) { ?>
            <span class="error"><?php echo $error_name; ?></span>
            <?php } ?></td>
        </tr>
        <tr>
          <td><?php echo $entry_image; ?></td>
        <tr>
          <td></td>
	  	  <td><span class="image" id="image_preview"></span></td>
        </tr>
        <tr>
          <td><?php echo $entry_image; ?></td>
          <td>
		    <select name="image_id" id="image_id" onchange="$('#image').load('index.php?controller=image&action=view&image_id='+$(this).val());">
              <?php foreach ($images as $image) { ?>
              <option value="<?php echo $image['image_id']; ?>" onmouseover="$('#preview_image').load('index.php?controller=image&action=view&image_id='+$(this).val());"<?php if ($image['image_id'] == $image_id) { ?> selected<?php } ?>><?php echo $image['title']; ?></option>
              <?php } ?>
            </select>
			<input type="button" name="image_preview_less" id="image_preview_less" value="&laquo;" />
			<input type="button" name="image_preview_more" id="image_preview_more" value="&raquo;" />
		  </td>
        </tr>
        <tr>
          <td><?php echo $entry_sort_order; ?></td>
          <td><input name="sort_order" value="<?php echo $sort_order; ?>" size="1" /></td>
        </tr>
      </table>
    </div>
  </div>
  <script type="text/javascript"><!--
	$(function() {
		$("#tabs").tabs();
	});
  //--></script>
</form> 
  
<script type="text/javascript"><!--
$('#image_preview').load('index.php?controller=image&action=view&image_id='+$('#image_id').val());
$("#image_preview_more").click(function(){
var val = parseInt($('#image_id').val())+1;
$('#image_id').val(val);
$('#image_preview').load('index.php?controller=image&action=view&image_id='+$('#image_id').val());
});
$("#image_preview_less").click(function(){
var val = parseInt($('#image_id').val())-1;
$('#image_id').val(val);
$('#image_preview').load('index.php?controller=image&action=view&image_id='+$('#image_id').val());
});
$("#image_id").click(function(){
$('#image_preview').load('index.php?controller=image&action=view&image_id='+$(this).val());
});
//$("#image_id option").hover(function(){
//$('#image_preview').load('index.php?controller=image&action=view&image_id='+$(this).val());
//});
//--></script>
